package cn.mumzone.pos.api;

import java.util.List;
import java.util.function.DoubleUnaryOperator;

import cn.mumzone.basic.net.response.BaseResponse;
import cn.mumzone.pos.model.CashServiceResult;
import cn.mumzone.pos.model.ReserveOrderEntity;
import cn.mumzone.pos.model.ReserveTimeEntity;
import cn.mumzone.pos.model.ReturnEntity;
import cn.mumzone.pos.model.ServerEntity;
import cn.mumzone.pos.model.ServerResultEntity;
import cn.mumzone.pos.model.ServerTimeTableEntity;
import cn.mumzone.pos.model.ShopUsableInfoEntity;
import okhttp3.RequestBody;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Created by qiuzhenhuan on 2019/6/26.
 */

public interface ReserveService {


    /**
     * 服务收银台接口
     *
     * @param status
     * @return
     */
    @FormUrlEncoded
    @POST("egg_order/api/v2.0/pos/service/selectAppointmentList")
    Observable<Response<BaseResponse<CashServiceResult>>> selectAppointmentList(@Field("isSwim") String isSwim,
                                                                                @Field("status") String status,
                                                                                @Field("keyWord") String keyWord,
                                                                                @Field("orderCode") String orderCode);

    /**
     * 获取门店可用服务列表
     *
     * @param memberId
     * @return
     */
    @GET("egg_goods/api/v1.5/pos/service/childrenSwimService")
    Observable<Response<BaseResponse<ShopUsableInfoEntity>>> getShopUsableServiceList(@Query("memberId") String memberId);


    /**
     * 获取门店可用技师列表
     *
     * @param memberId
     * @return
     */
    @GET("egg_order/api/v1/pos/service/selectServeList")
    Observable<Response<BaseResponse<ShopUsableInfoEntity>>> getShopUsableServerList(@Query("memberId") String memberId);


    /**
     * 添加产康/小儿游泳
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1/pos/service/saveServe")
    Observable<Response<BaseResponse<ReserveOrderEntity>>> addReserve(@Body RequestBody body);


    /**
     * 添加服务到预约单
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1/pos/service/saveServeOld")
    Observable<Response<BaseResponse<String>>> addServiceToReserve(@Body RequestBody body);

    /**
     * 删除子预约单
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1/pos/service/deleteSubAppointServe")
    Observable<Response<BaseResponse<String>>> deleteSubService(@Body RequestBody body);

    /**
     * 关闭预约单
     *
     * @param appointmentId
     * @return
     */
    @GET("egg_order/api/v1/pos/service/deleteServe")
    Observable<Response<BaseResponse<String>>> deleteServe(@Query("appointmentId") String appointmentId);


    /**
     * 查询预约详情
     *
     * @param appointmentId
     * @param type          1 服务预约 2 小儿游泳
     * @return
     */
    @FormUrlEncoded
    @POST("egg_order/api/v1.5/pos/order/selectOrderAppointmentDetail")
    Observable<Response<BaseResponse<ReserveOrderEntity>>> selectOrderAppointmentDetail(@Field("id") String appointmentId, @Field("type") String type);


    /**
     * 修改技师
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1/pos/service/updateSubAppointServe")
    Observable<Response<BaseResponse<String>>> updateReserveService(@Body RequestBody body);

    /**
     * 修改预约人信息
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1/pos/service/updateAppointmentInfo")
    Observable<Response<BaseResponse<String>>> updateAppointmentInfo(@Body RequestBody body);


    /**
     * 修改预约状态，顾客已到店使用
     *
     * @param appointmentId
     * @param state
     * @return
     */
    @GET("egg_order/api/v1/pos/service/updateServeState")
    Observable<Response<BaseResponse<String>>> updateServeState(@Query("appointmentId") String appointmentId,
                                                                @Query("state") String state);


    /**
     * 获取修改预约时间列表
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1/pos/service/updateTimeByOrderCode")
    Observable<Response<BaseResponse<List<ReserveTimeEntity>>>> getUpdateTimeByOrderCode(@Body RequestBody body);

    /**
     * 根据时间 + 服务时长 获取技师列表
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1.5/pos/service/selectableTechnician")
    Observable<Response<BaseResponse<ServerResultEntity>>> getUsableTechnicianList(@Body RequestBody body);


    /**
     * 获取修改可用技师列表
     *
     * @param appointmentId
     * @param appointmentTime
     * @return
     */
    @GET("egg_goods/api/v1.5/pos/service/noOccupyTechnician")
    Observable<Response<BaseResponse<List<ServerEntity>>>> getNoOccupyServer(@Query("appointmentId") String appointmentId,
                                                                             @Query("appointmentTime") String appointmentTime);


    /**
     * 结束占用
     *
     * @param body
     * @return
     */
    @POST("egg_goods/api/v1.5/pos/service/endOccupy")
    Observable<Response<BaseResponse<String>>> endOccupy(@Body RequestBody body);

    /**
     * 结束全部占用
     * @param body
     * @return
     */
    @POST("egg_goods/api/v2.0/pos/service/wholeEndOccupy")
    Observable<Response<BaseResponse<String>>> endAllOccupy(@Body RequestBody body);

    /**
     * 修改预约时间
     *
     * @param body
     * @return
     */
    @POST("egg_order/api/v1/pos/service/updateAppointmentOrderTimes")
    Observable<Response<BaseResponse<String>>> updateAppointmentTime(@Body RequestBody body);


    /**
     * 获取技师时间占用表
     *
     * @param newDate
     * @return
     */
    @GET("egg_goods/api/v2.0/pos/service/getReservationService")
    Observable<Response<BaseResponse<ServerTimeTableEntity>>> getServerTimeTable(@Query("newDate") String newDate, @Query("orderType") String orderType);
}
